import { defineComponent } from 'vue'
import { DeleteOutlined, EditOutlined } from '@ant-design/icons-vue'
import './style.less'

const actionsMap = {
  edit: EditOutlined,
  delete: DeleteOutlined
}

export default defineComponent({
  name: 'MsActions',
  emits: Object.keys(actionsMap),
  setup (_, { emit }) {
    return () => (
      <div class="ms-actions">
        {
          Object.entries(actionsMap).map(([key, Icon]) => (<Icon class={['ms-actions__icon', key]} key={key} onClick={(e) => { emit(key, e) }} />))
        }
      </div>
    )
  }
})
